#!/bin/sh

# start/stop/restart radicale

radicale_start() {
	daemon -n radicale -u radicale -o local1.warning -e "HOME=/var/lib/radicale" -D /var/lib/radicale -- python3 -m radicale
}

radicale_stop() {
	daemon -n radicale -u radicale --stop
}

radicale_restart() {
  radicale_stop
  sleep 1
  radicale_start
}

case "$1" in
'start')
  radicale_start
  ;;
'stop')
  radicale_stop
  ;;
'restart')
  radicale_restart
  ;;
*)
  echo "usage $0 start|stop|restart"
esac
